/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ejb.warehouse;

import ejb.system.AbstractFacade;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author ciummo
 */
@Stateless
public class ArticoloFacade extends AbstractFacade<Articolo> implements ArticoloFacadeRemote {
    @PersistenceContext(unitName = "DGestEJBSeverPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public ArticoloFacade() {
        super(Articolo.class);
    }
    
   public List<Articolo> aritcoliNonCheck() {
       
       
       
       try{
           
        String sql = "select distinct a from Articolo a where a.codArticolo not in (select c.codArticolo from Controllo c)";
        Query query = em.createQuery(sql);
        return query.getResultList();
        
       }catch(Exception ex){
            ex.printStackTrace();
            
       }
       return null;
    }
    
}
